import math
#求解素数
def get_primer_number(num):
    primer_numbers=[2]
    i=3
    while i<=num:
        is_kk=False
        for k in range(2,i):
            if i%k!=0:
                continue
            else:
                is_kk=True
                break
        if not is_kk:
            primer_numbers.append(i)
        i+=1
    print(primer_numbers)
def get_primer_number_2(num):
    primer_numbers=[2]
    i=3
    while i<=num:
        is_kk=False
        for k in range(2,int(math.sqrt(i))+1):
            if i%k!=0:
                continue
            else:
                is_kk=True
                break
        if not is_kk:
            primer_numbers.append(i)
        i+=1
    print(primer_numbers)
#筛选啊
def get_primer_number_3(num):
    s=1
    k=[]
    for i in range(num):
        k.append(i)
    k[0]=k[1]=0
    for i in range(2,num):
        if k[i]:
            k[s]=i
            s+=1
        j=i*2
        while j<num:
            k[j]=0
            j+=i
    primer_number=[]
    for i in range(1,s):
        primer_number.append(k[i])
    print(primer_number)
get_primer_number_3(1000)


